import request from "./request";
import qs from "qs";
export const JingpinAPI = () => request.get("/products/recommend");
export const HotAPI = () => request.get("/products/hot");
export const Details = (id) => request.get(`/products/${id}`);
export const goodProducts = ({ type, min, max, keyword } = {}) =>
  request.get("/products", {
    params: {
      type,
      min,
      max,
      keyword,
    },
  });
export const sendsmsAPI = (params) =>
  request.post("/sendSMS", qs.stringify(params));
export const phoneReginAPI = (params) =>
  request.post("/phoneRegin", qs.stringify(params));
export const userInfo = () => request.get("/shop/userProfiles");
// 微信登录（这个接口必须用qs对数据进行格式化）
export const WeixinLoginApi = (params) =>
  request.post(`/wechatUsers/PCLogin`, qs.stringify(params));
//手机绑定微信请求
export const BindPhoneAPI = (params) =>
  request.post(`/wechatUsers/binding`, qs.stringify(params));
export const showCartShop = () => request.get("/shop/carts");
export const addCartShop = (params) =>
  request.post("/shop/carts/add", qs.stringify(params));

export const delCartShop = (id) =>
  request.delete("/shop/carts", {
    params: {
      productIds: id,
    },
  });

export const unbindingWeChat = () =>
  request.put("/wechatUsers/unbindingWeChat");
